Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
com.ccwangluo.accelerator
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
sheteng
com.ccwangluo.accelerator
Commits
971ef221
Commit
971ef221
authored
Sep 15, 2014
by
Max Lv
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix a data race
parent
c35a92a9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
5 deletions
+11
-5
src/main/scala/com/github/shadowsocks/utils/Console.scala
src/main/scala/com/github/shadowsocks/utils/Console.scala
+11
-5
No files found.
src/main/scala/com/github/shadowsocks/utils/Console.scala
View file @
971ef221
...
...
@@ -57,7 +57,10 @@ object Console {
.
open
(
new
OnCommandResultListener
{
override
def
onCommandResult
(
commandCode
:
Int
,
exitCode
:
Int
,
output
:
util.List
[
String
])
{
if
(
exitCode
<
0
)
shell
=
null
if
(
exitCode
<
0
)
{
shell
.
close
()
shell
=
null
}
}
})
}
...
...
@@ -82,8 +85,9 @@ object Console {
if
(
shell
==
null
)
{
openShell
()
}
shell
.
addCommand
(
commands
)
shell
.
waitForIdle
()
val
ts
=
shell
ts
.
addCommand
(
commands
)
ts
.
waitForIdle
()
}
def
runRootCommand
(
command
:
String
)
:
String
=
runRootCommand
(
Array
(
command
))
...
...
@@ -95,11 +99,13 @@ object Console {
if
(
rootShell
==
null
)
{
openRootShell
()
}
val
ts
=
rootShell
val
sb
=
new
StringBuilder
rootShell
.
addCommand
(
commands
,
0
,
new
OnCommandResultListener
{
ts
.
addCommand
(
commands
,
0
,
new
OnCommandResultListener
{
override
def
onCommandResult
(
commandCode
:
Int
,
exitCode
:
Int
,
output
:
util.List
[
String
])
{
if
(
exitCode
<
0
)
{
rootShell
.
close
()
rootShell
=
null
}
else
{
import
scala.collection.JavaConversions._
...
...
@@ -107,7 +113,7 @@ object Console {
}
}
})
if
(
rootShell
.
waitForIdle
())
sb
.
toString
()
if
(
ts
.
waitForIdle
())
sb
.
toString
()
else
null
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment