Connect to X server
This commit is contained in:
parent
75cf74c217
commit
8f9b767ce1
5
bin/uhwm
Executable file
5
bin/uhwm
Executable file
@ -0,0 +1,5 @@
|
||||
#!/usr/bin/env ruby
|
||||
|
||||
require 'uh/wm'
|
||||
|
||||
Uh::WM::CLI.run!(ARGV)
|
4
features/steps/run_steps.rb
Normal file
4
features/steps/run_steps.rb
Normal file
@ -0,0 +1,4 @@
|
||||
When /^I start uhwm$/ do
|
||||
@process = run 'uhwm'
|
||||
@interactive = @process
|
||||
end
|
10
features/steps/x_steps.rb
Normal file
10
features/steps/x_steps.rb
Normal file
@ -0,0 +1,10 @@
|
||||
Then /^it must connect to X display$/ do
|
||||
Timeout.timeout(exit_timeout) do
|
||||
loop do
|
||||
break if assert_partial_output_interactive 'Connected to'
|
||||
sleep 0.1
|
||||
end
|
||||
end
|
||||
expect(`sockstat -u`.lines.grep /\s+ruby.+\s+#{@process.pid}/)
|
||||
.not_to be_empty
|
||||
end
|
@ -1,4 +1,12 @@
|
||||
require 'aruba/cucumber'
|
||||
require 'headless'
|
||||
|
||||
module Aruba
|
||||
class SpawnProcess
|
||||
def pid
|
||||
@process.pid
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Headless.new.start
|
||||
|
5
features/x/connection.feature
Normal file
5
features/x/connection.feature
Normal file
@ -0,0 +1,5 @@
|
||||
Feature: connection to X server
|
||||
|
||||
Scenario: connects to X server
|
||||
When I start uhwm
|
||||
Then it must connect to X display
|
3
lib/uh/wm.rb
Normal file
3
lib/uh/wm.rb
Normal file
@ -0,0 +1,3 @@
|
||||
require 'uh'
|
||||
|
||||
require 'uh/wm/cli'
|
15
lib/uh/wm/cli.rb
Normal file
15
lib/uh/wm/cli.rb
Normal file
@ -0,0 +1,15 @@
|
||||
module Uh
|
||||
module WM
|
||||
class CLI
|
||||
class << self
|
||||
def run! arguments
|
||||
$stdout.sync = true
|
||||
@display = Display.new
|
||||
@display.open
|
||||
puts "Connected to X server on `#{display}'"
|
||||
sleep 8
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
Loading…
x
Reference in New Issue
Block a user