File tree Expand file tree Collapse file tree 2 files changed +43
-1
lines changed
Expand file tree Collapse file tree 2 files changed +43
-1
lines changed Original file line number Diff line number Diff line change 3737 - ruby : { name: truffleruby, value: truffleruby-24.2.1 }
3838 os : { name: Ubuntu, value: ubuntu-24.04 }
3939
40+ - ruby : { name: "no symlinks", value: 4.0.0 }
41+ os : { name: Windows, value: windows-2025 }
42+ symlink : off
43+
4044 steps :
45+ - name : disable development mode on Windows
46+ run : powershell -c "Set-ItemProperty -Path HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\AppModelUnlock -Name AllowDevelopmentWithoutDevLicense -Value 0"
47+ if : matrix.symlink == 'off'
4148 - uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
4249 with :
4350 persist-credentials : false
4855 bundler : none
4956 - name : Install Dependencies
5057 run : bin/rake setup
58+ - name : Run Test with non-Admin user
59+ run : |
60+ gem inst win32-process --no-doc --conservative
61+ ruby bin/windows_run_as_user ruby -S rake test
62+ if : matrix.symlink == 'off'
5163 - name : Run Test
5264 run : bin/rake test
53- if : matrix.ruby.name != 'truffleruby' && matrix.ruby.name != 'jruby'
65+ if : matrix.ruby.name != 'truffleruby' && matrix.ruby.name != 'jruby' && matrix.symlink != 'off'
5466 - name : Run Test isolatedly
5567 run : bin/rake test:isolated
5668 if : matrix.ruby.name == '3.4' && matrix.os.name != 'Windows'
Original file line number Diff line number Diff line change 1+ require "win32/process"
2+ require "rbconfig"
3+
4+ TESTUSER = "testuser"
5+
6+ system("net user #{TESTUSER} /del 2>NUL")
7+ system("net user #{TESTUSER} \"Password123+\" /add") || raise
8+ system("icacls . /grant #{TESTUSER}:(OI)(CI)(IO)(F)")
9+
10+ stdout_read, stdout_write = IO.pipe
11+ cmd = ARGV.join(" ")
12+ env = {
13+ "TMP" => "#{Dir.pwd}/tmp",
14+ "TEMP" => "#{Dir.pwd}/tmp"
15+ }
16+ pinfo = Process.create command_line: cmd,
17+ with_logon: TESTUSER,
18+ password: "Password123+",
19+ cwd: Dir.pwd,
20+ environment: ENV.to_h.merge(env).map{|k,v| "#{k}=#{v}" },
21+ startup_info: { stdout: stdout_write, stderr: stdout_write }
22+
23+ stdout_write.close
24+ out = stdout_read.read
25+ puts out
26+
27+ # Wait for process to terminate
28+ sleep 0.1 while !(ecode=Process.get_exitcode(pinfo.process_id))
29+
30+ exit ecode
You can’t perform that action at this time.
0 commit comments