Skip to content

Commit

Permalink
fix(arduino-cli): get rid of shell:true for all platforms
Browse files Browse the repository at this point in the history
  • Loading branch information
brusherru committed Dec 2, 2019
1 parent 70a9cf5 commit 1b85eaa
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions packages/arduino-cli/src/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import os from 'os';
import * as R from 'ramda';
import { resolve } from 'path';
import { promisifyChildProcess } from 'promisify-child-process';
Expand All @@ -17,8 +16,6 @@ const spawn = (bin, args, options) =>
});

const noop = () => {};
const IS_WIN = os.platform() === 'win32';
const escapeSpacesNonWin = R.unless(() => IS_WIN, R.replace(/\s/g, '\\ '));

/**
* Initializes object to work with `arduino-cli`
Expand All @@ -36,12 +33,10 @@ const ArduinoCli = (pathToBin, config = null) => {
runningProcesses = R.reject(R.equals(proc), runningProcesses);
};

const escapedConfigPath = escapeSpacesNonWin(configPath);
const runWithProgress = async (onProgress, args) => {
const spawnArgs = R.concat([`--config-file=${escapedConfigPath}`], args);
const proc = spawn(escapeSpacesNonWin(pathToBin), spawnArgs, {
const spawnArgs = R.concat([`--config-file=${configPath}`], args);
const proc = spawn(pathToBin, spawnArgs, {
stdio: ['inherit', 'pipe', 'pipe'],
shell: !IS_WIN, // TODO: Can we get rid of `shell: true` for other platforms?
});
proc.stdout.on('data', data => onProgress(data.toString()));
proc.stderr.on('data', data => onProgress(data.toString()));
Expand Down

0 comments on commit 1b85eaa

Please sign in to comment.