summaryrefslogtreecommitdiff
path: root/js/process.ts
diff options
context:
space:
mode:
authorKitson Kelly <me@kitsonkelly.com>2019-03-10 04:30:38 +1100
committerRyan Dahl <ry@tinyclouds.org>2019-03-09 12:30:38 -0500
commit034e2cc02829c9244b32232074c7a48af827a2fb (patch)
treebade01606a1ee076c1f753ce99c97ddb1e4edf30 /js/process.ts
parent8c7a12d1b258f0ef5ab27f49c424331d43e8d97f (diff)
Migrate from tslint to eslint for linting (#1905)
Diffstat (limited to 'js/process.ts')
-rw-r--r--js/process.ts43
1 files changed, 21 insertions, 22 deletions
diff --git a/js/process.ts b/js/process.ts
index 2f60e5c4a..bf75b6b32 100644
--- a/js/process.ts
+++ b/js/process.ts
@@ -22,7 +22,6 @@ import { assert, unreachable } from "./util";
export type ProcessStdio = "inherit" | "piped" | "null";
// TODO Maybe extend VSCode's 'CommandOptions'?
-// tslint:disable-next-line:max-line-length
// See https://code.visualstudio.com/docs/editor/tasks-appendix#_schema-for-tasksjson
export interface RunOptions {
args: string[];
@@ -33,6 +32,27 @@ export interface RunOptions {
stdin?: ProcessStdio;
}
+async function runStatus(rid: number): Promise<ProcessStatus> {
+ const builder = flatbuffers.createBuilder();
+ msg.RunStatus.startRunStatus(builder);
+ msg.RunStatus.addRid(builder, rid);
+ const inner = msg.RunStatus.endRunStatus(builder);
+
+ const baseRes = await dispatch.sendAsync(builder, msg.Any.RunStatus, inner);
+ assert(baseRes != null);
+ assert(msg.Any.RunStatusRes === baseRes!.innerType());
+ const res = new msg.RunStatusRes();
+ assert(baseRes!.inner(res) != null);
+
+ if (res.gotSignal()) {
+ const signal = res.exitSignal();
+ return { signal, success: false };
+ } else {
+ const code = res.exitCode();
+ return { code, success: code === 0 };
+ }
+}
+
export class Process {
readonly rid: number;
readonly pid: number;
@@ -156,24 +176,3 @@ export function run(opt: RunOptions): Process {
return new Process(res);
}
-
-async function runStatus(rid: number): Promise<ProcessStatus> {
- const builder = flatbuffers.createBuilder();
- msg.RunStatus.startRunStatus(builder);
- msg.RunStatus.addRid(builder, rid);
- const inner = msg.RunStatus.endRunStatus(builder);
-
- const baseRes = await dispatch.sendAsync(builder, msg.Any.RunStatus, inner);
- assert(baseRes != null);
- assert(msg.Any.RunStatusRes === baseRes!.innerType());
- const res = new msg.RunStatusRes();
- assert(baseRes!.inner(res) != null);
-
- if (res.gotSignal()) {
- const signal = res.exitSignal();
- return { signal, success: false };
- } else {
- const code = res.exitCode();
- return { code, success: code === 0 };
- }
-}