Skip to content

Session 7 - using child Processes #38

@Fabiomfff

Description

@Fabiomfff

//---------------------------------list logs
cli.responders.listLogs = function () {
cli.verticalSpace();
var ls = childProcess.spawn('ls', ['./.logs/']);
ls.stdout.on('data', function (dataObj) {
// Explode into separate lines
var dataStr = dataObj.toString();
var logFileNames = dataStr.split('\n');
logFileNames.forEach(function (logFileName) {
if (typeof (logFileName) == 'string' && logFileName.trim().length > 0 && logFileName.indexOf('-') > -1) {
console.log(logFileName.trim().split('.')[0]);
cli.verticalSpace();
}
});
});
};

It says that spawn LS is ENOENT, i tried to use the entire coppied path to .logs but it does not work, if i find a fix i will post it here, for now its not working for me at least.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions