mirror of
https://github.com/balena-io/etcher.git
synced 2025-04-24 07:17:18 +00:00
refactor(GUI): increase writer proxy logging (#576)
We were facing quite some issues that involved debugging the writer child process, which proved to be a very difficult task given the lack of information we're exposing to the parent. This is an attempt to improve that situation. Signed-off-by: Juan Cruz Viotti <jviottidc@gmail.com>
This commit is contained in:
parent
1308177d54
commit
b965b5d835
@ -77,6 +77,10 @@ exports.write = (image, drive, options) => {
|
||||
env: process.env
|
||||
});
|
||||
|
||||
child.stdout.on('data', (data) => {
|
||||
console.info(`WRITER: ${data.toString()}`);
|
||||
});
|
||||
|
||||
child.stderr.on('data', (data) => {
|
||||
emitter.emit('error', new Error(data.toString()));
|
||||
});
|
||||
|
@ -46,6 +46,7 @@ return isElevated().then((elevated) => {
|
||||
const logFile = process.env[CONSTANTS.TEMPORARY_LOG_FILE_ENVIRONMENT_VARIABLE];
|
||||
|
||||
if (process.send) {
|
||||
console.log(`Tailing ${logFile}`);
|
||||
|
||||
// Sadly, `fs.createReadStream()` won't work since
|
||||
// the stream that function returns gets closed
|
||||
@ -77,6 +78,7 @@ return isElevated().then((elevated) => {
|
||||
}
|
||||
|
||||
if (!elevated) {
|
||||
console.log('Attempting to elevate');
|
||||
|
||||
if (os.platform() === 'win32') {
|
||||
const elevator = Bluebird.promisifyAll(require('elevator'));
|
||||
@ -192,8 +194,19 @@ return isElevated().then((elevated) => {
|
||||
});
|
||||
}
|
||||
|
||||
console.log('Re-spawning with elevation');
|
||||
|
||||
return new Bluebird((resolve, reject) => {
|
||||
const child = childProcess.spawn(EXECUTABLE, ETCHER_ARGUMENTS);
|
||||
|
||||
child.stdout.on('data', (data) => {
|
||||
console.log(data.toString());
|
||||
});
|
||||
|
||||
child.stderr.on('data', (data) => {
|
||||
console.error(data.toString());
|
||||
});
|
||||
|
||||
child.on('error', reject);
|
||||
child.on('close', resolve);
|
||||
}).then((exitCode) => {
|
||||
|
Loading…
x
Reference in New Issue
Block a user