Skip to content

Commit

Permalink
feat(cli): Make it work on windows for real
Browse files Browse the repository at this point in the history
tested with cmd.exe, git bash and powershell
  • Loading branch information
lgeiger committed Oct 16, 2016
1 parent 4d112b9 commit 4db1047
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 5 deletions.
File renamed without changes.
5 changes: 3 additions & 2 deletions bin/win/nteract.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,12 @@ FOR %%a IN (%*) DO (
IF /I "%%a"=="-v" SET EXPECT_OUTPUT=YES
IF /I "%%a"=="--version" SET EXPECT_OUTPUT=YES
IF /I "%%a"=="--verbose" SET EXPECT_OUTPUT=YES
)

IF "%EXPECT_OUTPUT%"=="YES" (
%NTERACT_EXE% %NTERACT_DIR %*
%NTERACT_EXE% %NTERACT_DIR% %*
) ELSE (
set ELECTRON_RUN_AS_NODE=1
%NTERACT_EXE% "%~dp0\nteract.js" %*
call %NTERACT_EXE% "%~dp0\nteract.js" %*
)
endlocal
1 change: 1 addition & 0 deletions bin/win/nteract.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
var path = require('path');
var spawn = require('child_process').spawn;

delete process.env.ELECTRON_RUN_AS_NODE
var args = process.argv.slice(2);
if (process.env.NTERACT_DIR) {
args.unshift(process.env.NTERACT_DIR);
Expand Down
6 changes: 3 additions & 3 deletions src/main/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,9 @@ const setWinPathObservable = (exe, rootDir, binDir) => {
.filter((item, index, array) => array.indexOf(item) === index);
env.push(binDir);
const envPath = env.join(';');
return spawn('SETX', ['PATH', `"${envPath}`])
.map('SETX', ['NTERACT_EXE', `"${exe}"`])
.map('SETX', ['NTERACT_DIR', `"${rootDir}"`]);
return spawn('SETX', ['PATH', `${envPath}`])
.switchMap(() => spawn('SETX', ['NTERACT_EXE', exe]))
.switchMap(() => spawn('SETX', ['NTERACT_DIR', rootDir]));
};

const createSymlinkObservable = (target, path) =>
Expand Down

0 comments on commit 4db1047

Please sign in to comment.