mirror of
https://github.com/TangentFoxy/.lua-files.git
synced 2024-11-20 21:34:23 +00:00
lots of shit happening trying to get output from something running in WSL
This commit is contained in:
parent
8dbfcf1dce
commit
81a3f1066f
38
popen-command-test.lua
Normal file
38
popen-command-test.lua
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
|
||||||
|
function os.command(command)
|
||||||
|
local file = assert(io.popen(command, 'r'))
|
||||||
|
local output = assert(file:read('*a'))
|
||||||
|
file:close()
|
||||||
|
return output
|
||||||
|
end
|
||||||
|
|
||||||
|
function string.trim6(s)
|
||||||
|
return s:match'^()%s*$' and '' or s:match'^%s*(.*%S)'
|
||||||
|
end
|
||||||
|
|
||||||
|
print("---")
|
||||||
|
|
||||||
|
-- local home = os.command("echo %userprofile%")
|
||||||
|
-- home = string.trim6(home)
|
||||||
|
-- print(home)
|
||||||
|
|
||||||
|
-- local dolphin_cheese = os.command("wsl -- ollama run dolphin-mixtral \"Say only the word 'cheese'.\"")
|
||||||
|
-- local dolphin_cheese = os.command("wsl")
|
||||||
|
-- os.execute("C:\\Windows\\System32\\wsl.exe")
|
||||||
|
-- local dolphin_cheese = os.command("echo %path%")
|
||||||
|
-- local dolphin_cheese = os.command("where wsl")
|
||||||
|
-- print(dolphin_cheese)
|
||||||
|
|
||||||
|
-- print(os.command("bash -c \"$PATH\""))
|
||||||
|
-- os.execute("bash -c \"ollama help\"")
|
||||||
|
|
||||||
|
-- runs but doesn't return anything?
|
||||||
|
-- local dolphin_cheese = os.command("pwsh -Command wsl -- ollama run dolphin-mixtral \"Say only the word 'cheese'.\"")
|
||||||
|
-- print(dolphin)
|
||||||
|
|
||||||
|
-- os.execute("pwsh -Command wsl -- ollama run dolphin-mixtral \"Say only the word 'cheese'.\"")
|
||||||
|
|
||||||
|
-- this will output to file in the correct place :D
|
||||||
|
os.execute("pwsh -Command wsl --exec \"ollama run dolphin-mixtral \\\"Say only the word 'cheese'.\\\"\" > test-output-file.txt")
|
||||||
|
|
||||||
|
print("---")
|
Loading…
Reference in New Issue
Block a user