From 00b5b877b40d1770be43655f00d862cc9ef4814c Mon Sep 17 00:00:00 2001 From: Oliver Sand Date: Thu, 8 Oct 2020 11:53:16 +0200 Subject: [PATCH] fix(techdocs-cli): make techdocs-cli work on Windows (#2779) $(pwd) won't work outside a Unix shell, so I replaced it with process.cwd(). Then it's not important anymore in which directory the docker command is executed. --- packages/techdocs-cli/src/index.ts | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/packages/techdocs-cli/src/index.ts b/packages/techdocs-cli/src/index.ts index b48f03d35b..da196d10b8 100644 --- a/packages/techdocs-cli/src/index.ts +++ b/packages/techdocs-cli/src/index.ts @@ -20,11 +20,7 @@ import path from 'path'; import HTTPServer from './lib/httpServer'; import openBrowser from 'react-dev-utils/openBrowser'; -const run = ( - workingDirectory: string, - name: string, - args: string[] = [], -): ChildProcess => { +const run = (name: string, args: string[] = []): ChildProcess => { const [stdin, stdout, stderr] = [ 'inherit' as const, 'pipe' as const, @@ -32,7 +28,6 @@ const run = ( ]; const childProcess = spawn(name, args, { - cwd: workingDirectory, stdio: [stdin, stdout, stderr], shell: true, env: { @@ -59,13 +54,13 @@ const runMkdocsServer = (options?: { const devAddr = options?.devAddr ?? '0.0.0.0:8000'; return new Promise(resolve => { - const childProcess = run(process.env.PWD!, 'docker', [ + const childProcess = run('docker', [ 'run', '-it', '-w', '/content', '-v', - '$(pwd):/content', + `${process.cwd()}:/content`, '-p', '8000:8000', 'spotify/techdocs',