Skip to content
GitLab
Menu
Why GitLab
Pricing
Contact Sales
Explore
Why GitLab
Pricing
Contact Sales
Explore
Sign in
Get free trial
Primary navigation
Search or go to…
Project
O
outvoke
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Privacy statement
Keyboard shortcuts
?
What's new
4
Snippets
Groups
Projects
cleemy desu wayo
outvoke
Commits
d03657e6
Commit
d03657e6
authored
1 day ago
by
cleemy desu wayo
Browse files
Options
Downloads
Patches
Plain Diff
Fix bug: fix weird way to manipulate Thread
parent
818e5ce1
Branches
main
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
outvoke.rb
+22
-10
22 additions, 10 deletions
outvoke.rb
samples/2024/fixbug_20240928_stdin_001.rb
+18
-0
18 additions, 0 deletions
samples/2024/fixbug_20240928_stdin_001.rb
samples/2024/fixbug_20240928_stdin_002.rb
+28
-0
28 additions, 0 deletions
samples/2024/fixbug_20240928_stdin_002.rb
with
68 additions
and
10 deletions
outvoke.rb
+
22
−
10
ファイルを表示 @
d03657e6
#!/usr/bin/env ruby
#
# ==========================================================================
# Outvoke -- version 0.0.99.2024092
5.1
# Outvoke -- version 0.0.99.2024092
8
#
# written by cleemy desu wayo / Licensed under CC0 1.0
#
...
...
@@ -23,7 +23,7 @@ class Outvoke
@version
=
Struct
.
new
(
:branch
,
:body
).
new
(
'0.1'
,
'0.0.99.2024092
5.1
'
'0.0.99.2024092
8
'
)
@sources
=
Hash
.
new
...
...
@@ -410,23 +410,35 @@ class OutvokeDataSourceStdin < OutvokeDataSource
@thread_stdin
=
Thread
.
new
do
Thread
.
stop
loop
do
tmp
=
@stdin
.
next
Thread
.
stop
unless
@is_enabled
Thread
.
current
[
"tmp"
]
=
@stdin
.
next
Thread
.
stop
unless
@is_enabled
@mutex_stdin
.
synchronize
do
@stdin_new_lines
<<
tmp
.
chomp
@stdin_new_lines
<<
Thread
.
current
[
"
tmp
"
]
.
chomp
end
end
end
end
def
enabled
=
(
x
)
@is_enabled
=
x
@is_enabled
=
!!
x
if
@is_enabled
sleep
0.05
# TODO
@thread_stdin
.
run
else
@thread_stdin
.
stop
return
false
unless
@is_enabled
sleep
0.05
# TODO
tmp_status
=
@thread_stdin
.
status
if
tmp_status
==
"run"
||
tmp_status
==
"sleep"
begin
@thread_stdin
.
run
rescue
ThreadError
return
false
end
end
true
end
def
each_event
...
...
This diff is collapsed.
Click to expand it.
samples/2024/fixbug_20240928_stdin_001.rb
0 → 100644
+
18
−
0
ファイルを表示 @
d03657e6
# for Outvoke 0.1
# written by cleemy desu wayo / Licensed under CC0 1.0
# initial release of this sample: 2024-09-28
# --------
#
# this is a sample code to check for the presence of a bug that is fixed in
# Outvoke version 0.0.99.20240928.
#
# usage:
#
# $ seq 1 3 | ./outvoke.rb samples/2024/fixbug_20240928_stdin_001.rb
#
using
OutvokeDSL
hook
"stdin"
sleep
1
hook
"stdin"
This diff is collapsed.
Click to expand it.
samples/2024/fixbug_20240928_stdin_002.rb
0 → 100644
+
28
−
0
ファイルを表示 @
d03657e6
# for Outvoke 0.1
# written by cleemy desu wayo / Licensed under CC0 1.0
# initial release of this sample: 2024-09-28
# --------
#
# this is a sample code to check for the presence of a bug that is fixed in
# Outvoke version 0.0.99.20240928.
#
# usage:
#
# $ { i=0 ; while true ; do echo "$i" ; sleep 1 ; i=$(expr "$i" + 1) ; done ; } | ./outvoke.rb samples/2024/fixbug_20240928_stdin_002.rb
#
using
OutvokeDSL
hook
"every-sec"
,
/ ..:..:.[0]/
do
|
e
|
$outvoke
.
sources
[
"stdin"
].
enabled
=
false
"set false ----
#{
e
.
body
}
"
end
hook
"every-sec"
,
/ ..:..:.[3]/
do
|
e
|
$outvoke
.
sources
[
"stdin"
].
enabled
=
true
"set true ----
#{
e
.
body
}
"
end
hook
"stdin"
$outvoke
.
sources
[
"stdin"
].
enabled
=
false
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment