pmflow 1.2.4__tar.gz → 1.2.6__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pmflow
3
- Version: 1.2.4
3
+ Version: 1.2.6
4
4
  Summary: Manages processes
5
5
  Author-email: "Md. Mahmudul Hasan Riyad" <mhriyad98@gmail.com>
6
6
  License: MIT License
@@ -8,10 +8,10 @@ The commands this module manages are
8
8
 
9
9
  import typer
10
10
  import psutil
11
+ import random
11
12
  import subprocess
12
13
  from pm.settings import state
13
14
  from typing import Optional
14
- from enum import Enum
15
15
  from typing_extensions import Annotated
16
16
  from pm.schema import Relation
17
17
 
@@ -28,18 +28,21 @@ def create(command: Annotated[str, typer.Argument()],
28
28
  typer.echo(f"Error 800: Please specify an existing group of a parent process")
29
29
  raise typer.Exit(code=1)
30
30
  elif group not in state.get_parents_groupname():
31
- typer.echo(f"Error 801: No parent group with this name exist. "
31
+ typer.echo(f"Error 801: No parent group with this group name exist. "
32
32
  f"Please specify an existing group of a parent process")
33
33
  raise typer.Exit(code=1)
34
34
 
35
- proc = subprocess.Popen(command, shell=True)
36
- pid = proc.pid
37
-
38
35
  if relation == Relation.PARENT:
39
36
  if not group:
40
- group = str(pid)
37
+ group = f"group-{random.randint(1, 1000000)}"
41
38
  elif state.is_group_exist(group):
42
39
  typer.echo(f"Error 802: A group can have only one parent process.")
40
+ raise typer.Exit(code=1)
41
+
42
+ proc = subprocess.Popen(command, shell=True)
43
+ pid = proc.pid
44
+
45
+
43
46
 
44
47
  data = {
45
48
  "command": command,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pmflow
3
- Version: 1.2.4
3
+ Version: 1.2.6
4
4
  Summary: Manages processes
5
5
  Author-email: "Md. Mahmudul Hasan Riyad" <mhriyad98@gmail.com>
6
6
  License: MIT License
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "pmflow"
7
- version = "1.2.4"
7
+ version = "1.2.6"
8
8
  description = "Manages processes"
9
9
  readme = "README.md"
10
10
  authors =[{name = "Md. Mahmudul Hasan Riyad", email = "mhriyad98@gmail.com"}]
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes