Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
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
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
3337130e
Commit
3337130e
authored
Feb 26, 2018
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use Gitlab::Popen instead of spawn [ci skip]
Signed-off-by:
Dmitriy Zaporozhets
<
dmitriy.zaporozhets@gmail.com
>
parent
84097def
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
16 deletions
+3
-16
lib/gitlab/plugin.rb
lib/gitlab/plugin.rb
+3
-16
No files found.
lib/gitlab/plugin.rb
View file @
3337130e
...
@@ -13,24 +13,11 @@ module Gitlab
...
@@ -13,24 +13,11 @@ module Gitlab
end
end
def
self
.
execute
(
file
,
data
)
def
self
.
execute
(
file
,
data
)
# Prepare the hook subprocess. Attach a pipe to its stdin, and merge
_output
,
exit_status
=
Gitlab
::
Popen
.
popen
([
file
])
do
|
stdin
|
# both its stdout and stderr into our own stdout.
stdin
.
write
(
data
.
to_json
)
stdin_reader
,
stdin_writer
=
IO
.
pipe
hook_pid
=
spawn
({},
file
,
in:
stdin_reader
,
err: :out
)
stdin_reader
.
close
# Submit changes to the hook via its stdin.
begin
IO
.
copy_stream
(
StringIO
.
new
(
data
.
to_json
),
stdin_writer
)
rescue
Errno
::
EPIPE
# It is not an error if the hook does not consume all of its input.
end
end
# Close the pipe to let the hook know there is no further input.
exit_status
.
zero?
stdin_writer
.
close
Process
.
wait
(
hook_pid
)
$?
.
success?
end
end
end
end
end
end
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