Jenkins中的pipenv shell返回问题termios.error:(25,“设备的不适当的ioctl") [英] pipenv shell in Jenkins return the issue termios.error: (25, 'Inappropriate ioctl for device')
问题描述
我的詹金斯(Jenkins)遇到问题,当我运行工作时,詹金斯(Jenkins)遵循以下步骤:
I have a problem with my Jenkins that when I run a Job, Jenkins follow these steps:
1 - pipenv install -r requirements.txt
2 - pipenv shell
在此步骤显示此错误:
+ pipenv shell
17:26:04 Loading .env environment variables…
17:26:04 Launching subshell in virtual environment…
17:26:04 Traceback (most recent call last):
17:26:04 File "/usr/local/bin/pipenv", line 11, in <module>
17:26:04 sys.exit(cli())
17:26:04 File "/usr/local/lib/python3.6/dist-packages/pipenv/vendor/click/core.py", line 764, in __call__
17:26:04 return self.main(*args, **kwargs)
17:26:04 File "/usr/local/lib/python3.6/dist-packages/pipenv/vendor/click/core.py", line 717, in main
17:26:04 rv = self.invoke(ctx)
17:26:04 File "/usr/local/lib/python3.6/dist-packages/pipenv/vendor/click/core.py", line 1137, in invoke
17:26:04 return _process_result(sub_ctx.command.invoke(sub_ctx))
17:26:04 File "/usr/local/lib/python3.6/dist-packages/pipenv/vendor/click/core.py", line 956, in invoke
17:26:04 return ctx.invoke(self.callback, **ctx.params)
17:26:04 File "/usr/local/lib/python3.6/dist-packages/pipenv/vendor/click/core.py", line 555, in invoke
17:26:04 return callback(*args, **kwargs)
17:26:04 File "/usr/local/lib/python3.6/dist-packages/pipenv/vendor/click/decorators.py", line 64, in new_func
17:26:04 return ctx.invoke(f, obj, *args, **kwargs)
17:26:04 File "/usr/local/lib/python3.6/dist-packages/pipenv/vendor/click/core.py", line 555, in invoke
17:26:04 return callback(*args, **kwargs)
17:26:04 File "/usr/local/lib/python3.6/dist-packages/pipenv/cli/command.py", line 390, in shell
17:26:04 pypi_mirror=state.pypi_mirror,
17:26:04 File "/usr/local/lib/python3.6/dist-packages/pipenv/core.py", line 2184, in do_shell
17:26:04 shell.fork_compat(*fork_args)
17:26:04 File "/usr/local/lib/python3.6/dist-packages/pipenv/shells.py", line 121, in fork_compat
17:26:04 c.interact(escape_character=None)
17:26:04 File "/usr/local/lib/python3.6/dist-packages/pipenv/vendor/pexpect/pty_spawn.py", line 761, in interact
17:26:04 mode = tty.tcgetattr(self.STDIN_FILENO)
17:26:04 termios.error: (25, 'Inappropriate ioctl for device')
17:26:04 Build step 'Execute shell' marked build as failure
17:26:05 Finished: FAILURE
我已经搜索了此错误,但是发现的所有内容对我都不起作用,例如:
I've searched for this error and everything I found doesn't work for me, for instance:
1- Execute pipenv shell --fancy
2-如果我进入Jenkins机器并运行pipenv shell,它将通过
2 - If I get in Jenkins machine and run pipenv shell it goes through
root@ip:~/.jenkins/workspace/Midhaz-Back-New-MR# pipenv shell
+ pipenv shell
Loading .env environment variables…
Launching subshell in virtual environment…
root@ip:~/.jenkins/workspace/Midhaz-Back-New-MR# . /root/.local/share/virtualenvs/Midhaz-Back-New-MR-TllOp5eO/bin/activate
(Midhaz-Back-New-MR) root@ip:~/.jenkins/workspace/Midhaz-Back-New-MR#
推荐答案
Jenkins是一个非交互式环境.所有的用户输入都将被取消,并且它只是一个输出控制台.
Jenkins is a non-interactive environment. All user input is nullified, and it's just an output console.
因此,如果不重定向标准输入,就无法从中运行交互式shell.
So you cannot run an interactive shell from it without redirection of the standard input.
您可能想要一些非交互式但仍在您的虚拟环境中的东西,例如:
You probably want something non-interactive but still in your virtual environment like:
pipenv run python my_script.py my_argument_1
这篇关于Jenkins中的pipenv shell返回问题termios.error:(25,“设备的不适当的ioctl")的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!