After this change, the CLI becomes the only entity actually performing
I/O with the devices, and the GUI is just a wrapper around it.
When you click "Flash", the GUI spawns the CLI with all the appropriate
options, including `--ipc`, which uses an IPC communication channel to
report status back to the parent process.
Signed-off-by: Juan Cruz Viotti <jviottidc@gmail.com>
The binary used when spawning the CLI in OS X during development is
`electron-prebuilt/disk/Electron.app/Contents/MacOS/Electron`.
To make sure we catch both `Electron` and `electron`, make the
executable name lowercase before comparing it.
Signed-off-by: Juan Cruz Viotti <jviottidc@gmail.com>
The CLI now attempts to detect whether it is being run as an argument to
a JavaScript runner (like node or electron), or as a final packaged
executable by applying some heuristics on the first argument.
Signed-off-by: Juan Cruz Viotti <jviottidc@gmail.com>
This option makes the Etcher CLI outputs state information in a way that
can be easily parsed by a parent process spawning it.
The format of the state output is:
<type> <percentage>% <eta>s <speed>
This can be easily parsed as follows:
const output = line.split(' ');
const state = {
type: output[0],
percentage: parseInt(output[1], 10),
eta: parseInt(output[2], 10),
speed: parseInt(output[3], 10)
};
Signed-off-by: Juan Cruz Viotti <jviottidc@gmail.com>
This PR integrates the Etcher CLI code-wise, but doesn't yet handles the
distribution part of the story.
Signed-off-by: Juan Cruz Viotti <jviottidc@gmail.com>