Toggle navigation
Toggle navigation
This project
Loading...
Sign in
엄성진
/
learn-in-web-backend
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
sungjin
2021-12-06 00:32:52 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
227a8888d28e53927e8e6528e22d61f283198aff
227a8888
1 parent
9f4b8808
Fix cpp error
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
31 additions
and
9 deletions
src/post/post.controller.ts
src/runner/runner.service.ts
src/post/post.controller.ts
View file @
227a888
...
...
@@ -22,7 +22,7 @@ export class PostController {
body
.
example
,
body
.
testinput
,
body
.
testoutput
,
body
.
level
,
body
.
difficulty
,
);
}
...
...
@@ -37,7 +37,7 @@ export class PostController {
body
.
example
,
body
.
testinput
,
body
.
testoutput
,
body
.
level
,
body
.
difficulty
,
);
}
...
...
src/runner/runner.service.ts
View file @
227a888
...
...
@@ -46,6 +46,9 @@ export class RunnerService {
case
'ts'
:
{
this
.
ts
(
body
,
location
);
}
case
'py'
:
{
this
.
py
(
body
,
location
);
}
}
}
c
(
body
:
any
,
location
:
string
)
{
...
...
@@ -90,13 +93,10 @@ export class RunnerService {
shell
:
true
,
});
console
.
log
(
test
.
stderr
);
const
result
=
child_process
.
spawnSync
(
'.'
+
location
.
slice
(
0
,
location
.
length
-
4
),
{
encoding
:
'utf8'
,
shell
:
true
,
},
);
const
result
=
child_process
.
spawnSync
(
'./tmp'
,
{
encoding
:
'utf8'
,
shell
:
true
,
});
console
.
log
(
result
.
stdout
);
output
.
push
(
result
.
stdout
as
string
);
}
...
...
@@ -186,6 +186,28 @@ export class RunnerService {
}
return
output
;
}
py
(
body
:
any
,
location
:
string
)
{
const
output
:
Array
<
string
>
=
[];
if
(
body
.
input
==
[])
{
const
result
=
child_process
.
spawnSync
(
'python3'
,
[
location
],
{
encoding
:
'utf8'
,
shell
:
true
,
});
console
.
log
(
result
.
stdout
);
output
.
push
(
result
.
stdout
as
string
);
}
for
(
const
ip
of
body
.
input
)
{
const
result
=
child_process
.
spawnSync
(
'python3'
,
[
location
],
{
encoding
:
'utf8'
,
shell
:
true
,
input
:
ip
,
});
console
.
log
(
result
.
stdout
);
output
.
push
(
result
.
stdout
as
string
);
}
return
output
;
}
// ts() {
// if ((this.input = [])) {
// const test = child_process.spawnSync(
...
...
Please
register
or
login
to post a comment