add tty option to exec
This commit is contained in:
+2
-2
@@ -651,7 +651,7 @@ function exec(appId, options, callback) {
|
|||||||
AttachStdin: true,
|
AttachStdin: true,
|
||||||
AttachStdout: true,
|
AttachStdout: true,
|
||||||
AttachStderr: true,
|
AttachStderr: true,
|
||||||
Tty: true,
|
Tty: options.tty,
|
||||||
Cmd: cmd
|
Cmd: cmd
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -659,7 +659,7 @@ function exec(appId, options, callback) {
|
|||||||
if (error) return callback(new AppsError(AppsError.INTERNAL_ERROR, error));
|
if (error) return callback(new AppsError(AppsError.INTERNAL_ERROR, error));
|
||||||
var startOptions = {
|
var startOptions = {
|
||||||
Detach: false,
|
Detach: false,
|
||||||
Tty: true,
|
Tty: options.tty,
|
||||||
stdin: true // this is a dockerode option that enabled openStdin in the modem
|
stdin: true // this is a dockerode option that enabled openStdin in the modem
|
||||||
};
|
};
|
||||||
exec.start(startOptions, function(error, stream) {
|
exec.start(startOptions, function(error, stream) {
|
||||||
|
|||||||
+3
-1
@@ -357,7 +357,9 @@ function exec(req, res, next) {
|
|||||||
var rows = req.query.rows ? parseInt(req.query.rows, 10) : null;
|
var rows = req.query.rows ? parseInt(req.query.rows, 10) : null;
|
||||||
if (isNaN(rows)) return next(new HttpError(400, 'rows must be a number'));
|
if (isNaN(rows)) return next(new HttpError(400, 'rows must be a number'));
|
||||||
|
|
||||||
apps.exec(req.params.id, { cmd: cmd, rows: rows, columns: columns }, function (error, duplexStream) {
|
var tty = req.query.tty === 'true' ? true : false;
|
||||||
|
|
||||||
|
apps.exec(req.params.id, { cmd: cmd, rows: rows, columns: columns, tty: tty }, function (error, duplexStream) {
|
||||||
if (error && error.reason === AppsError.NOT_FOUND) return next(new HttpError(404, 'No such app'));
|
if (error && error.reason === AppsError.NOT_FOUND) return next(new HttpError(404, 'No such app'));
|
||||||
if (error && error.reason === AppsError.BAD_STATE) return next(new HttpError(409, error.message));
|
if (error && error.reason === AppsError.BAD_STATE) return next(new HttpError(409, error.message));
|
||||||
if (error) return next(new HttpError(500, error));
|
if (error) return next(new HttpError(500, error));
|
||||||
|
|||||||
Reference in New Issue
Block a user