Page Menu
Home
Sealhub
Search
Configure Global Search
Log In
Files
F1262767
exec.ts
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
728 B
Referenced Files
None
Subscribers
None
exec.ts
View Options
/* eslint-disable no-console */
import
{
spawn
}
from
"child_process"
;
export
async
function
exec
(
program
:
string
,
args
:
string
[]
)
:
Promise
<
{
stderr
:
string
;
stdout
:
string
;
exitCode
:
number
}
>
{
return
new
Promise
((
resolve
,
reject
)
=>
{
let
stdout
=
""
;
let
stderr
=
""
;
const
process
=
spawn
(
program
,
args
);
process
.
stdout
.
on
(
"data"
,
(
data
:
Buffer
)
=>
(
stdout
+=
data
.
toString
()));
process
.
stderr
.
on
(
"data"
,
(
data
:
Buffer
)
=>
(
stderr
+=
data
.
toString
()));
process
.
on
(
"close"
,
(
exitCode
)
=>
{
if
(
exitCode
===
0
)
{
resolve
({
stdout
,
stderr
,
exitCode
});
}
else
{
console
.
error
([
program
,
...
args
].
join
(
" "
));
console
.
error
(
stderr
);
reject
({
stdout
,
stderr
,
exitCode
});
}
});
});
}
File Metadata
Details
Attached
Mime Type
text/x-java
Expires
Fri, Jan 24, 15:16 (1 d, 4 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
601299
Default Alt Text
exec.ts (728 B)
Attached To
Mode
rSGEN sealgen
Attached
Detach File
Event Timeline
Log In to Comment