Skip to content
This repository has been archived by the owner on Apr 10, 2023. It is now read-only.

Commit

Permalink
🚑 Fixed bug that prevented users from install Pip requirements
Browse files Browse the repository at this point in the history
  • Loading branch information
simse committed Apr 23, 2019
1 parent 34b70c9 commit 3297d02
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 4 deletions.
5 changes: 3 additions & 2 deletions chronos-ui/src/components/ScriptEditor.vue
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
<h3><strong>Pip requirements</strong></h3>

<b-field label="requirements.txt">
<b-input type="textarea" v-modal="local_script.requirements"></b-input>
<b-input type="textarea" v-model="local_script.requirements"></b-input>
</b-field>
</div>

Expand Down Expand Up @@ -174,7 +174,8 @@ export default {
name: this.local_script.name,
interval: this.local_script.interval,
enabled: this.local_script.enabled,
contents: this.local_script.contents
contents: this.local_script.contents,
requirements: this.local_script.requirements
}).then(response => {
})
Expand Down
14 changes: 12 additions & 2 deletions chronos/script.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,19 @@ def to_dict(self):

def install_requirements(self):
"""Install requirements.txt"""
process = subprocess.check_output(['bash', self.install_requirements_path], universal_newlines=True)
process = Popen(['bash', self.install_requirements_path], stdin=PIPE, stdout=PIPE, stderr=PIPE,
bufsize=-1)

output, error = process.communicate()

# Check if it errored or was successful
process_output = ''
if process.returncode == 0:
process_output = output
else:
process_output = error

return process
return process_output.decode('utf-8')

def execute(self):
"""Execute script"""
Expand Down
2 changes: 2 additions & 0 deletions tests/test_database.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
def test_answer():
assert 5 == 5

0 comments on commit 3297d02

Please sign in to comment.