Skip to content

Commit

Permalink
fix(core): use relative paths for socket path (#10896)
Browse files Browse the repository at this point in the history
Co-authored-by: Craigory Coppola <craigorycoppola@gmail.com>
  • Loading branch information
lewsmith and AgentEnder committed Mar 17, 2023
1 parent 0af052b commit f60f8cd
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions packages/nx/src/daemon/socket-utils.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import { unlinkSync } from 'fs';
import { platform } from 'os';
import { resolve } from 'path';
import { relative, resolve } from 'path';
import { DAEMON_SOCKET_PATH } from './tmp-dir';
import { ProjectGraph } from '../config/project-graph';
import { workspaceRoot } from '../utils/workspace-root';

export const isWindows = platform() === 'win32';

Expand All @@ -10,10 +12,12 @@ export const isWindows = platform() === 'win32';
*
* See https://nodejs.org/dist/latest-v14.x/docs/api/net.html#net_identifying_paths_for_ipc_connections for a full breakdown
* of OS differences between Unix domain sockets and named pipes.
*
* Updated non-windows platforms to use relative paths allowing for workspaces that exist in long paths.
*/
export const FULL_OS_SOCKET_PATH = isWindows
? '\\\\.\\pipe\\nx\\' + resolve(DAEMON_SOCKET_PATH)
: resolve(DAEMON_SOCKET_PATH);
: relative(workspaceRoot, resolve(DAEMON_SOCKET_PATH));

export function killSocketOrPath(): void {
try {
Expand Down

1 comment on commit f60f8cd

@vercel
Copy link

@vercel vercel bot commented on f60f8cd Mar 17, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

nx-dev – ./

nx-five.vercel.app
nx-dev-git-master-nrwl.vercel.app
nx.dev
nx-dev-nrwl.vercel.app

Please sign in to comment.